package com.seek.springevent.listen;

import com.seek.springevent.event.LoanAuditEvent;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

import java.util.concurrent.ExecutorService;

@Log
@Component
public class CountListener implements ApplicationListener<LoanAuditEvent> {

    @Autowired
    private ExecutorService executorService;

    @Override
    public void onApplicationEvent(LoanAuditEvent event) {
        executorService.execute(()->{
            log.info("=========spring 异步事件============");
        });
    }
}
